class Collects:

    def __init__(self):
        self.data = dict()

    def __getitem__(self, key):
        return self.data[key]

    def __setitem__(self, key, value):
        if key not in self.data:
            self.data[key] = value
        else:
            if self.data[key] == value:
                raise Warning('%s repeat add ' % value)
            else:
                raise ValueError('%s already exists ' % value)

    def __repr__(self):
        return "Collects(%s)" % len(self)

    def __str__(self):
        data = ["Collects(%s)" % len(self)]
        for key in self.data:
            data.append(str(self[key]))
        return '\n'.join(data)

    def get(self, key, default=None):
        return self.data.get(key, default)
